<html>
<%@page contentType="text/html; charset=UTF-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<script language="JavaScript" type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
<!-- 新 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="static/css/bootstrap.css">
<!-- 可选的Bootstrap主题文件（一般不用引入） -->
<link rel="stylesheet" href="static/css/bootstrap-theme.min.css">
<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="static/js/jquery-1.9.1.min.js"></script>
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="/static/js/bootstrap.js"></script>
<body>
<h2>学生信息展示</h2>
<a href="/getGradeName">添加员工信息</a>
<form name="form1" id="form1" method="post" action="/findStuGradeCondition">
    <input type="hidden" name="pageNo" value="1" id="setPage"/>
    <label for="exampleInputName1">姓名:</label>
    <input type="text" name="name" value="${stuCondition.name}" class="form-control" id="exampleInputName1" PLACEHOLDER="name"/>
    <label for="exampleInputName2">年龄:</label>
    <input type="text" name="startAge" value="${stuCondition.startAge}" class="form-control" id="exampleInputName2" placeholder="startAge"/>-<input type="text" name="endAge" value="${stuCondition.endAge}" class="form-control" placeholder="endAge"/>
    <button type="submit"  class="btn btn-info" >
    <span class="glyphicon glyphicon-search" aria-hidden="true"></span>搜索</button>
</form>
<table border="2" class="table table-striped">
    <tr>
        <td>学生编号</td>
        <td>学生姓名</td>
        <td>性别</td>
        <td>年级编号</td>
        <td>年级名称</td>
        <td>生日</td>
        <td>地址</td>
        <td>操作</td>
    </tr>
    <c:forEach items="${stus.list}" var="s">
        <tr>
            <td>${s.studentno}</td>
            <td>${s.studentname}</td>
            <td>${s.sex}</td>
            <td>${s.gradeid}</td>
            <td>${s.gradeName}</td>
            <td><fmt:formatDate value="${s.borndate}" pattern="yyyy-MM-dd"></fmt:formatDate></td>
            <td>${s.address}</td>
            <%--<td><a href="javascript:goDel()">删除</a></td>--%>
            <td><a href="/delStu?studentno=${s.studentno}" id="button" class="glyphicon glyphicon-trash">删除${temp}</a><a href="/getSingleStu?studentno=${s.studentno}" class="glyphicon glyphicon-pencil">修改</a></td>
        </tr>
    </c:forEach>
</table>
<div>
    <div>每页${stus.pageSize}条,当前第${stus.pageNum}/${stus.pages}页,总共${stus.total}条记录</div>
    <div>
        <a href="javascript:goPage(1)">首页</a>
        <a href="javascript:goPage(${stus.prePage==0?1:stus.prePage})">上一页</a>
        <a href="javascript:goPage(${stus.nextPage==0?stus.pages:stus.nextPage})">下一页</a>
        <a href="javascript:goPage(${stus.pages})">尾页</a>
    </div>
    <div>
        <select
        onchange="location.href='findStuLim?pageNo='+this.value;">
            <option value="">请选择</option>
            <c:forEach begin="1" end="${stus.pages}" var="i" step="1">
                <option ${i==stus.pageNum?"selected":""} value="${i}">第${i}页</option>
            </c:forEach>
        </select>
    </div>
    <c:forEach begin="1" end="${stus.pages}" var="i" step="1">
        <a href="javascript:goPage(${i})"  class="btn btn-default">${i}</a>
    </c:forEach>
</div>
</body>
<script language="JavaScript" type="text/javascript">
    $(function () {
        $("#button").click(function () {
            alert("确定要删除吗?")
        })
    })
    <%--function goDel() {--%>
       <%--if(confirm("确认删除吗")){--%>
           <%--console.log(${temp==-1})--%>
           <%--location.href='delStu?studentno='+${s.studentno};--%>
       <%--}--%>
    <%--}--%>

    function goPage(pageNum) {
        $("#setPage").val(pageNum);
        $("#form1").submit();
    }

</script>
</html>
